home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Text Processing / Free Text 1.03 / Stack indexer⁄browser v.1.03 / Stack indexer_browser v.1.03 / stack_-1.xml < prev    next >
Encoding:
Extensible Markup Language  |  1993-12-27  |  8.4 KB  |  22 lines

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE stack PUBLIC "-//Apple, Inc.//DTD stack V 2.0//EN" "" >
  3. <stack>
  4.     <name>in.03</name>
  5.     <id>-1</id>
  6.     <cardCount>2</cardCount>
  7.     <cardID>17566</cardID>
  8.     <listID>2288</listID>
  9.     <cantModify><false /></cantModify>
  10.     <cantDelete><false /></cantDelete>
  11.     <cantAbort><false /></cantAbort>
  12.     <cardSize>
  13.         <width>512</width>
  14.         <height>208</height>
  15.     </cardSize>
  16.     <script>-- modified stack script for stack browsing, based originally on
  17. -- Free Text v.1 ... not thoroughly checked or tested yet!!!
  18.  
  19. on openStack
  20. initGlobals    -- set up many things for this stack
  21. pass openStack
  22. end openStack
  23.  
  24. on closeStack
  25. -- close out files, vars, empty fields nicely
  26. set cursor to watch
  27. lock screen
  28. repeat for the number of cards -- close all database files
  29. if the short name of this bkgnd is "BrowserBg" then closeDatabase
  30. go to next card
  31. end repeat
  32. show menuBar
  33. pass closeStack
  34. end closeStack
  35.  
  36. on closeDatabase
  37. -- called before opening a file as well as when leaving the stack
  38. get openCloseFiles (getTextFileRefNum(), getKeyFileRefNum(),¬¨
  39. getPtrFileRefNum())
  40. if not (getSubsetHandle(1) = 0 or getSubsetHandle(1) = empty) then
  41. get zbrowser ("RELEASESUBSET", getSubsetHandle(1))
  42. setSubsetHandle 1,0
  43. end if
  44. if not (getSubsetHandle(2) = 0 or getSubsetHandle(2) = empty) then
  45. get zbrowser ("RELEASESUBSET", getSubsetHandle(2))
  46. setSubsetHandle 2,0
  47. end if
  48. put empty into field "FTVars"
  49. put empty into field "Index1"
  50. put empty into field "Index2"
  51. put empty into field "Context"
  52. put empty into field "Database Name"
  53. hide field "searchPattern1"
  54. hide field "searchPattern2"
  55. hide bg button "and subsets"
  56. hide bg button "or subsets"
  57. hide bg button "not subset 1"
  58. hide bg button "not subset 2"
  59. hide bg button "fill subset 1"
  60. hide bg button "fill subset 2"
  61. end closeDatabase
  62.  
  63. on initGlobals
  64. -- initialize many things here for the stack to use globally
  65. global indexLines, contextLines, maxIndexSampleCount,¬¨
  66. indexCountWidth, indexKeyWidth, contextLineLength, contextWordOffset,¬¨
  67. maxContextLinesSkipped, textChunkSize, textOffset, errorCount,¬¨
  68. contextGutterWidth, whichSubset
  69. put 7 into indexLines -- hold this many lines in Index fields
  70. put 7 into contextLines -- hold this many lines in Context field
  71. put 100 into maxIndexSampleCount -- sample size during subset counts
  72. put 5 into indexCountWidth -- this many digits of count info for Index
  73. put 28 into indexKeyWidth -- this many letters of Index words
  74. put 80 into contextLineLength -- this many letters of Context
  75. put 35 into contextWordOffset -- key word starts in this column
  76. put 100 into maxContextLinesSkipped
  77. -- make a line of dots after this many lines in subset are skipped
  78. put 25000 into textChunkSize -- grab this much for text field
  79. put 1 into textOffset -- put key word this far into text chunk
  80. put 0 into errorCount -- initialize counter to control error display
  81. put 0 into contextGutterWidth -- spaces before key word
  82. put 1 into whichSubset -- identify which subset, 1 or 2, is being used
  83. end initGlobals
  84.  
  85. on checkOpenDatabase
  86. -- test to catch attempt to operate without an open indexed file;
  87. -- try turning it into an "Open Database" request if so!
  88. if (getTextFileRefNum() = 0  or getTextFileRefNum() = empty) then
  89. beep
  90. answer "No database open!"
  91. exit to HyperCard
  92. end if
  93. end checkOpenDatabase
  94.  
  95. function clickedLineNum
  96. -- compute which line number of the field got the click
  97. return 1 + trunc((item 2 of the clickLoc - (item 2 of (the rectangle¬¨
  98. of the target))) / (the textheight of the target))
  99. end clickedLineNum
  100.  
  101. function clickedOnLeftHalf
  102. -- see if click was on left half of the button, for AND and OR subsets
  103. put item 1 of the clickLoc into clickX
  104. put ((item 1 of the rect of the target) + (item 3 of the rect of the¬¨
  105. target)) / 2 into midPointX
  106. return (clickX < midPointX)
  107. end clickedOnLeftHalf
  108.  
  109. on browseIndex1
  110. -- fill Index field #1
  111. global indexLines, maxIndexSampleCount, indexCountWidth, indexKeyWidth
  112. get zbrowser ("INDEX", getwordnum1(), indexLines,¬¨
  113. maxIndexSampleCount, indexCountWidth, indexKeyWidth,¬¨
  114. getKeyFileRefNum(), getPtrFileRefNum(), getSubsetHandle(1))
  115. put line 1 to indexLines of It into field "Index1"
  116. setInstanceList1 (line (indexLines+1) to (2*indexLines) of It)
  117. end browseIndex1
  118.  
  119. on browseIndex2
  120. -- fill Index field #2
  121. global indexLines, maxIndexSampleCount, indexCountWidth, indexKeyWidth
  122. get zbrowser ("INDEX", getwordnum2(), indexLines,¬¨
  123. maxIndexSampleCount, indexCountWidth, indexKeyWidth,¬¨
  124. getKeyFileRefNum(), getPtrFileRefNum(), getSubsetHandle(2))
  125. put line 1 to indexLines of It into field "Index2"
  126. setInstanceList2 (line (indexLines+1) to (2*indexLines) of It)
  127. end browseIndex2
  128.  
  129. on browseContext lineOffset
  130. -- fill the Context field
  131. global contextLines, contextLineLength, contextWordOffset,¬¨
  132. maxContextLinesSkipped, contextGutterWidth, whichSubset
  133. get zbrowser ("CONTEXT", getInstanceNum(), contextLines,¬¨
  134. lineOffset, contextLineLength, contextWordOffset,¬¨
  135. maxContextLinesSkipped, contextGutterWidth, getPtrFileRefNum(),¬¨
  136. getTextFileRefNum(), getSubsetHandle(whichSubset))
  137. put line 1 to contextLines of It into field Context
  138. setTextPtrList (line (contextLines+1) to (2*contextLines) of It)
  139. end browseContext
  140.  
  141. --
  142. -- the remaining functions set and fetch values of various useful
  143. -- quantities; do it this way to hide the details of how things are
  144. -- stored....
  145. --
  146.  
  147. function getTextFileRefNum
  148. return line 1 of field FTVars
  149. end getTextFileRefNum
  150.  
  151. on setTextFileRefNum refNum
  152. put refNum into line 1 of field FTVars
  153. end setTextFileRefNum
  154.  
  155. function getKeyFileRefNum
  156. return line 2 of field FTVars
  157. end getKeyFileRefNum
  158.  
  159. on setKeyFileRefNum refNum
  160. put refNum into line 2 of field FTVars
  161. end setKeyFileRefNum
  162.  
  163. function getPtrFileRefNum
  164. return line 3 of field FTVars
  165. end getPtrFileRefNum
  166.  
  167. on setPtrFileRefNum refNum
  168. put refNum into line 3 of field FTVars
  169. end setPtrFileRefNum
  170.  
  171. function getWordNum1
  172. return line 4 of field FTVars
  173. end getWordNum1
  174.  
  175. on setWordNum1 wordNum
  176. put wordNum into line 4 of field FTVars
  177. end setWordNum1
  178.  
  179. function getWordNum2
  180. return line 5 of field FTVars
  181. end getWordNum2
  182.  
  183. on setWordNum2 wordNum
  184. put wordNum into line 5 of field FTVars
  185. end setWordNum2
  186.  
  187. function getInstanceNum
  188. return line 6 of field FTVars
  189. end getInstanceNum
  190.  
  191. on setInstanceNum instanceNum
  192. put instanceNum into line 6 of field FTVars
  193. end setInstanceNum
  194.  
  195. function getTextStart
  196. return line 7 of field FTVars
  197. end getTextStart
  198.  
  199. on setTextStart textStart
  200. put textStart into line 7 of field FTVars
  201. end setTextStart
  202.  
  203. function getTextTarget
  204. return line 8 of field FTVars
  205. end getTextTarget
  206.  
  207. on setTextTarget textTarget
  208. put textTarget into line 8 of field FTVars
  209. end setTextTarget
  210.  
  211. function getTextEnd
  212. return line 9 of field FTVars
  213. end getTextEnd
  214.  
  215. on setTextEnd textEnd
  216. put textEnd into line 9 of field FTVars
  217. end setTextEnd
  218.  
  219. function getSubsetHandle subsetNumber
  220. return line 9+subsetNumber of field FTVars
  221. end getSubsetHandle
  222.  
  223. on setSubsetHandle subsetNumber, handle
  224. put handle into line 9+subsetNumber of field FTVars
  225. end setSubsetHandle
  226.  
  227. function getNeighborhoodSize
  228. return line 12 of field FTVars
  229. end getNeighborhoodSize
  230.  
  231. on setNeighborhoodSize size
  232. put size into line 12 of field FTVars
  233. end setNeighborhoodSize
  234.  
  235. -- lines 13 through 19 of field FTVars are currently unused
  236.  
  237. function getInstanceList1item instanceNum
  238. return line 19+instanceNum of field FTVars
  239. end getInstanceList1item
  240.  
  241. on setInstanceList1 instanceList
  242. global indexLines
  243. put instanceList into line 20 to 19+indexLines of field FTVars
  244. end setInstanceList1
  245.  
  246. function getInstanceList2item instanceNum
  247. global indexLines
  248. return line 19+indexLines+instanceNum of field FTVars
  249. end getInstanceList2item
  250.  
  251. on setInstanceList2 instanceList
  252. global indexLines
  253. put instanceList into line 20+indexLInes to 19+2*indexLines¬¨
  254. of field FTVars
  255. end setInstanceList2
  256.  
  257. function getTextPtrListInstanceItem itemNum
  258. global indexLines, contextLines
  259. return word 1 of line 19+2*indexLines+itemNum of field FTVars
  260. end getTextPtrListInstanceItem
  261.  
  262. function getTextPtrListPtrItem itemNum
  263. global indexLines, contextLines
  264. return word 2 of line 19+2*indexLines+itemNum of field FTVars
  265. end getTextPtrListPtrItem
  266.  
  267. on setTextPtrList textPtrList
  268. global indexLines, contextLines
  269. put textPtrList into line 20+2*indexLInes to 19+2*indexLines¬¨
  270. +contextLines of field FTVars
  271. end setTextPtrList
  272.  
  273.  
  274. </script>
  275.     <background id="2734" file="background_2734.xml" name="BrowserBg" />
  276.     <background id="3166" file="background_3166.xml" name="Documentation Bg" />
  277.     <card id="17566" file="card_17566.xml" marked="false" name="" owner="3166" />
  278.     <card id="2966" file="card_2966.xml" marked="false" name="FirstBrowserCard" owner="2734" />
  279. </stack>
  280.